#!/bin/bash


#
# Convert an image cropping it to a square
#
# ----------
# -- Args --
# ----------
# > width of the converted image

#generate random id
file=`mktemp`
path=/srv/upload-scripts/resources

#resize overlay
convert -strip -depth 8 -resize $1 "$path/layout.png" png:$file

#apply on crop
`dirname $0`/convertCrop $1 | \
convert - $file \
          -compose Multiply -composite \
            png:- | \
`dirname $0`/convertRoundedCorner $2 $3

#drop generated file
rm $file
